package com.yonyou.sto.modules.ums.util;

import cn.hutool.json.JSONObject;
import net.jodah.expiringmap.ExpirationPolicy;
import net.jodah.expiringmap.ExpiringMap;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class CacheUtilHttp {
    /**
     * 缓存回调信息
     */
    public static final ExpiringMap<String, JSONObject> Token_Cache = ExpiringMap.builder()
            .maxSize(1000)
            .expiration(12, TimeUnit.SECONDS)
            .variableExpiration()
            .expirationListener((key, value) -> {
                System.out.println( "key:"+key+" token:" + value + "已过期……");
            })
            .expirationPolicy(ExpirationPolicy.CREATED)
            .build();


}
